#
# -= Makefile for application =-
#
# Note:
# . "make config" must be done for initial routines.
#
# Usage:
# . Change the ROOT definition, if necessary;
#   Make it point to the root of the software tree.
#

# Destination to the root of software tree
ROOT = ../../../../..
ROOT_PRJ = ../prj/app/demo/combo/sabbat_dual
RLS_DATE = $(shell date +%y%m%d)

MAKEFILE = MakefileCommon

AOV_RELEASE_VERSION=$(RLS_DATE)

###### Only enable one product, disable the others ######
#AOV_PRODUCT=AOV_3821
#AOV_PRODUCT=AOV_276
AOV_PRODUCT=AOV_YJ
########################################
#Notice: Also need modifly file compiler_3821.def when add new options
#AOV_PRODUCT_NAME:	DTB276
#AOV_MODEL_NAME:		DTB276
#AOV_CUSTOMER_NAME:	AOV
#AOV_TUN_MODULE:		TUNER_MXL603, TUNER_TDA182I5
#AOV_RC_MODEL:		ARC010, ARC019, ARC020
#AOV_SUPPORT_MEM:		DDR2_64M, DDR3_128M
#YJ_RC_MODEL:		YAOJIN01, YAOJIN02

ifeq ($(AOV_PRODUCT),AOV_3821)	
	AOV_PRODUCT_NAME=DTB276
	AOV_MODEL_NAME=DTB276
	AOV_CUSTOMER_NAME=AOV
	AOV_TUN_MODULE=TUNER_MXL603
	AOV_RC_MODEL=ARC020
	AOV_SUPPORT_MEM=DDR2_64M
endif

ifeq ($(AOV_PRODUCT),AOV_276)
	AOV_PRODUCT_NAME=DTB276
	AOV_MODEL_NAME=DTB276
	AOV_CUSTOMER_NAME=AOV
	AOV_TUN_MODULE=TUNER_TDA182I5
	AOV_RC_MODEL=ARC020
	AOV_SUPPORT_MEM=DDR2_64M
endif

ifeq ($(AOV_PRODUCT),AOV_YJ)
	AOV_MODEL_NAME=DTB276
	AOV_CUSTOMER_NAME=AOV
	AOV_TUN_MODULE=TUNER_MXL603
	#AOV_RC_MODEL=YAOJIN01
	AOV_RC_MODEL=YAOJIN02
	#AOV_RC_MODEL=ARC020
	AOV_SUPPORT_MEM=DDR2_64M
ifeq ($(AOV_RC_MODEL),YAOJIN01)
	AOV_PRODUCT_NAME=DTB276_A
else
	AOV_PRODUCT_NAME=DTB276_B
endif
endif

export AOV_PRODUCT_NAME AOV_MODEL_NAME
export AOV_CUSTOMER_NAME
export AOV_TUN_MODULE
export AOV_RC_MODEL
export AOV_SUPPORT_MEM




	

# The command which is for Customer use
	
all :
	${MAKE} -f ${MAKEFILE} all

path:
# First step change sh to unix style, for win7 
	dos2unix *.sh
	dos2unix ${ROOT}/ddk/*
	./getpath.sh

config_print:	
	@echo AOV_PRODUCT_NAME=$(AOV_PRODUCT_NAME)	
	@echo AOV_MODEL_NAME=$(AOV_MODEL_NAME)
	@echo AOV_CUSTOMER_NAME=$(AOV_CUSTOMER_NAME)	
	@echo AOV_RC_MODEL=$(AOV_RC_MODEL)	
	@echo AOV_TUN_MODULE=$(AOV_TUN_MODULE)		
	@echo AOV_SUPPORT_MEM=$(AOV_SUPPORT_MEM)

BUILD_VERSION = $(ROOT)/inc/aov_version.h
BUILD_DATE = $(shell date +%Y/%m/%d)

build_version:
	@echo "#define AOV_SYS_INFO_PRODUCT_NAME \"$(AOV_PRODUCT_NAME)\"" > $(BUILD_VERSION)
	@echo "#define AOV_SYS_INFO_MODEL_NAME \"$(AOV_MODEL_NAME)\"" >> $(BUILD_VERSION)
	@echo "#define AOV_INFO_CUSTOMER_NAME \"$(AOV_CUSTOMER_NAME)\"" >> $(BUILD_VERSION)
	@echo "#define AOV_SYS_INFO_VERSION \"$(AOV_RELEASE_VERSION)\"" >> $(BUILD_VERSION)
	@echo "#define AOV_SYS_BUILD_DATE \"$(BUILD_DATE)\"" >> $(BUILD_VERSION)
config_cpu :
	${MAKE} -f ${MAKEFILE} config_cpu

config: config_print
	${MAKE} -f ${MAKEFILE} config_3821
	mkdir -p ${ROOT}/obj/${AOV_MODEL_NAME};
	
config_3811 :
	${MAKE} -f ${MAKEFILE} config_3811

config_3811_ota :
	${MAKE} -f ${MAKEFILE} config_3811_ota

config_3281 :
	${MAKE} -f ${MAKEFILE} config_3281
	
config_3281_ota :
	${MAKE} -f ${MAKEFILE} config_3281_ota

config_3503 :
	${MAKE} -f ${MAKEFILE} config_3503

config_3503_ota :
	${MAKE} -f ${MAKEFILE} config_3503_ota
	
config_3821 :
	${MAKE} -f ${MAKEFILE} config_3821

config_3821_ota :
	${MAKE} -f ${MAKEFILE} config_3821_ota		
new :
	echo ${MAKEFILE}"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
	${MAKE} -f ${MAKEFILE} new

ddk:	
	${MAKE} -f ${MAKEFILE} ddk

ui :
	${MAKE} -f ${MAKEFILE} ui
linkonly :
	${MAKE} -f ${MAKEFILE} linkonly
	
product_7z : build_version
	${MAKE} -f ${MAKEFILE} product_7z
	cp ${ROOT}/obj/product_sabbat_dual.abs ${ROOT}/obj/${AOV_MODEL_NAME}/${AOV_PRODUCT_NAME}-${AOV_RELEASE_VERSION}.abs

# The command which is Debug use

dis:
	${MAKE} -f ${MAKEFILE} dis
	
see_dis:
	${MAKE} -f ${MAKEFILE} see_dis

# The command which is for SDK use
bin:
	${MAKE} -f ${MAKEFILE} bin	

sync :
	${MAKE} -f ${MAKEFILE} sync
	
clean :
	${MAKE} -f ${MAKEFILE} clean

nim :
	${MAKE} -f ${MAKEFILE} nim

sat2ip_lib :
	${MAKE} -f ${MAKEFILE} sat2ip_lib

compress_7z :
	${MAKE} -f ${MAKEFILE} compress_7z

generate_7z :
	${MAKE} -f ${MAKEFILE} generate_7z

link :
	${MAKE} -f ${MAKEFILE} link

link_ota :
	${MAKE} -f ${MAKEFILE} link_ota

see_link : 
	${MAKE} -f ${MAKEFILE} see_link

see_link_ota :
	${MAKE} -f ${MAKEFILE} see_link_ota

cleanld :
	${MAKE} -f ${MAKEFILE} cleanld

label :
	${MAKE} -f ${MAKEFILE} label

label_core :
	${MAKE} -f ${MAKEFILE} label_core

label_sec :
	${MAKE} -f ${MAKEFILE} label_sec


sdk:
	${MAKE} -f ${MAKEFILE} sdk	

ddk_clean :
	${MAKE} -f ${MAKEFILE} ddk_clean
	
sdk_clean :
	${MAKE} -f ${MAKEFILE} sdk_clean

plus_clean:
	${MAKE} -f ${MAKEFILE} plus_clean
	
sdk_rel:
	${MAKE} -f ${MAKEFILE} sdk_rel

plus:
	${MAKE} -f ${MAKEFILE} plus

pplus:
	${MAKE} -f ${MAKEFILE} pplus

pplus_clean:
	${MAKE} -f ${MAKEFILE} pplus_clean

mheg5_v20_all:
	${MAKE} -f ${MAKEFILE} mheg5_v20_all	
	
mheg5_v20_core:	
	${MAKE} -f ${MAKEFILE} mheg5_v20_core
	
mheg5_v20_app:	
	${MAKE} -f ${MAKEFILE} mheg5_v20_app

mheg5_v20_all_clean :
	${MAKE} -f ${MAKEFILE} mheg5_v20_all_clean

mheg5_v20_core_clean :
	${MAKE} -f ${MAKEFILE} mheg5_v20_core_clean

mheg5_v20_app_clean :
	${MAKE} -f ${MAKEFILE} mheg5_v20_app_clean

mheg5_v20_rel:
	${MAKE} -f ${MAKEFILE} mheg5_v20_rel

ciplus_rel:
	${MAKE} -f ${MAKEFILE} ciplus_rel

bakcp:
	${MAKE} -f ${MAKEFILE} bakcp	
driver_debug:
	cp -f driver_debug.h ${ROOT}/inc/driver_debug.h
	echo "#include <driver_debug.h>">>${ROOT}/inc/sys_config.h
